package com.zzf.concurrent.example.ticket.bean;

import lombok.extern.slf4j.Slf4j;

import java.util.LinkedList;

/**
 * @author GaoFeng2017
 * @date 2019/8/4 21:54
 */
@Slf4j
public class TicketThread extends Thread {

    private String name;
    private static int max = 50;
    private static int currentIndex = 1;
    private static LinkedList<Integer> ids = new LinkedList<>();

    public TicketThread(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        while(currentIndex <= max) {
            int value = currentIndex++;
            log.info("{}开始叫号，当前号数为{}", name, value);
            ids.add(value);
        }

        log.info("ids size is {}", ids.size());
    }


}
